home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Misc / msql-1.0.6 / src / msql / msql.h < prev    next >
C/C++ Source or Header  |  1995-05-28  |  2KB  |  111 lines

  1. /*
  2. **    msql.h    - 
  3. **
  4. **
  5. ** Copyright (c) 1993  David J. Hughes
  6. **
  7. ** Permission to use, copy, and distribute for non-commercial purposes,
  8. ** is hereby granted without fee, providing that the above copyright
  9. ** notice appear in all copies and that both the copyright notice and this
  10. ** permission notice appear in supporting documentation.
  11. **
  12. ** This software is provided "as is" without any expressed or implied warranty.
  13. **
  14. ** ID = "$Id:"
  15. **
  16. */
  17.  
  18.  
  19. #if defined(__STDC__) || defined(__cplusplus)
  20. #  define __P(x)    x
  21. #else
  22. #  define __P(x)    ()
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. typedef    unsigned char    ** m_row;
  30.  
  31. typedef struct field_s {
  32.     char    *name,
  33.         *table;
  34.     int    type,
  35.         length,
  36.         flags;
  37. } m_field;
  38.  
  39.  
  40.  
  41. typedef    struct    m_data_s {
  42.     int    width;
  43.     m_row    data;
  44.     struct    m_data_s *next;
  45. } m_data;
  46.  
  47. typedef struct m_fdata_s {
  48.     m_field    field;
  49.     struct m_fdata_s *next;
  50. } m_fdata;
  51.  
  52.  
  53.  
  54. typedef struct result_s {
  55.         m_data     *queryData,
  56.                 *cursor;
  57.     m_fdata    *fieldData,
  58.         *fieldCursor;
  59.     int    numRows,
  60.         numFields;
  61. } m_result;
  62.  
  63.  
  64. #define    msqlNumRows(res) res->numRows
  65. #define    msqlNumFields(res) res->numFields
  66.  
  67.  
  68. #define INT_TYPE    1
  69. #define CHAR_TYPE    2
  70. #define REAL_TYPE    3
  71. #define IDENT_TYPE    4
  72. #define NULL_TYPE    5
  73.  
  74. #define NOT_NULL_FLAG   1
  75. #define PRI_KEY_FLAG    2
  76.  
  77. #define IS_PRI_KEY(n)    (n & PRI_KEY_FLAG)
  78. #define IS_NOT_NULL(n)    (n & NOT_NULL_FLAG)
  79.  
  80.  
  81. /*
  82. ** Pre-declarations for the API library functions
  83. */
  84. #ifndef _MSQL_SERVER_SOURCE
  85.     extern  char msqlErrMsg[];
  86.     int     msqlConnect __P((char *));
  87.     int     msqlSelectDB __P((int, char*));
  88.     int     msqlQuery __P((int, char*));
  89.     int     msqlCreateDB __P((int, char*));
  90.     int     msqlDropDB __P((int, char*));
  91.     int     msqlShutdown __P((int));
  92.     int     msqlReloadAcls __P((int));
  93.     int     msqlGetProtoInfo();
  94.     char     *msqlGetServerInfo();
  95.     char     *msqlGetHostInfo();
  96.     void    msqlClose __P((int));
  97.     void     msqlDataSeek __P((m_result*, int));
  98.     void     msqlFieldSeek __P((m_result*, int));
  99.     void     msqlFreeResult __P((m_result*));
  100.         m_row   msqlFetchRow __P((m_result*));
  101.     m_field    *msqlFetchField __P((m_result *));
  102.     m_result *msqlListDBs __P((int));
  103.     m_result *msqlListTables __P((int));
  104.     m_result *msqlListFields __P((int, char*));
  105.     m_result *msqlStoreResult();
  106. #endif
  107.  
  108. #ifdef __cplusplus
  109.     }
  110. #endif
  111.